package com.jzx.provider.cv.controller;

import com.jzx.provider.common.result.InvokeResult;
import com.jzx.provider.cv.dto.command.EducationInfoCommand;
import com.jzx.provider.cv.service.EducationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.Size;

/**
 * @author daihuihui
 * @date 2019/2/5
 */
@Validated
@RestController
@RequestMapping("/edu")
public class EducationInfoController {
    @Autowired
    private EducationInfoService educationInfoService;

    @PostMapping("/saveOrUpdate")
    public InvokeResult<Void> saveOrUpdate(@RequestBody @Validated EducationInfoCommand educationInfoCommand) {
        educationInfoService.saveOrUpdate(educationInfoCommand);
        return InvokeResult.success();
    }

    @PostMapping("/saveOrUpdateEducationInfo")
    public InvokeResult saveOrUpdateEducationInfo(@RequestBody @Validated EducationInfoCommand educationInfoCommand) {
        educationInfoService.saveOrUpdateEducationInfo(educationInfoCommand);
        return InvokeResult.success();
    }

    @GetMapping("/del/{id}")
    public InvokeResult<Void> deleteEdu(@PathVariable Integer id) {
        educationInfoService.deleteEdu(id);
        return InvokeResult.success();
    }
}
